﻿using FarPoint.Win;
using FarPoint.Win.Spread;
using FarPoint.Win.Spread.CellType;
using FarPoint.Win.Spread.Model;
using GrapeCity.Spreadsheet;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;
using ICellType = FarPoint.Win.Spread.CellType.ICellType;

namespace Spread.Worksheet.Features
{
		public partial class CellStyles : Spread.Common.Features.Sample.BaseSampleControl
		{
				NewStyle newStyle = null;
				List<string> customStyles = new List<string>();
				public CellStyles()
				{
						InitializeComponent();
						this.Load += Form1_Load;
				}

				private void Form1_Load(object sender, EventArgs e)
				{
						fpSpread2.ActiveSheet = fpSpread2_Sheet1;
						Workbook wb = (Workbook)fpSpread2.AsWorkbook();
						GrapeCity.Spreadsheet.Worksheet ws = (GrapeCity.Spreadsheet.Worksheet)wb.ActiveSheet;
						fpSpread2_Sheet1.RowCount = 50;
						// set styles
						ws.Cells[1, 0].ApplyStyle(BuiltInStyle.Normal);
						ws.Cells[1, 1].ApplyStyle(BuiltInStyle.Bad);
						ws.Cells[1, 2].ApplyStyle(BuiltInStyle.Good);
						ws.Cells[1, 3].ApplyStyle(BuiltInStyle.Neutral);
						ws.Cells[3, 0].ApplyStyle(BuiltInStyle.Calculation);
						ws.Cells[3, 1].ApplyStyle(BuiltInStyle.CheckCell);
						ws.Cells[3, 2].ApplyStyle(BuiltInStyle.ExplanatoryText);
						ws.Cells[3, 3].ApplyStyle(BuiltInStyle.Input);
						ws.Cells[3, 4].ApplyStyle(BuiltInStyle.LinkedCell);
						ws.Cells[3, 5].ApplyStyle(BuiltInStyle.Note);
						ws.Cells[4, 0].ApplyStyle(BuiltInStyle.Output);
						ws.Cells[4, 1].ApplyStyle(BuiltInStyle.WarningText);
						ws.Cells[6, 0].ApplyStyle(BuiltInStyle.Heading1);
						ws.Cells[6, 1].ApplyStyle(BuiltInStyle.Heading2);
						ws.Cells[6, 2].ApplyStyle(BuiltInStyle.Heading3);
						ws.Cells[6, 3].ApplyStyle(BuiltInStyle.Heading4);
						ws.Cells[6, 4].ApplyStyle(BuiltInStyle.Title);
						ws.Cells[6, 5].ApplyStyle(BuiltInStyle.Total);
						ws.Cells[8, 0].ApplyStyle(BuiltInStyle.Percent20Accent1);
						ws.Cells[8, 1].ApplyStyle(BuiltInStyle.Percent20Accent2);
						ws.Cells[8, 2].ApplyStyle(BuiltInStyle.Percent20Accent3);
						ws.Cells[8, 3].ApplyStyle(BuiltInStyle.Percent20Accent4);
						ws.Cells[8, 4].ApplyStyle(BuiltInStyle.Percent20Accent5);
						ws.Cells[8, 5].ApplyStyle(BuiltInStyle.Percent20Accent6);
						ws.Cells[9, 0].ApplyStyle(BuiltInStyle.Percent40Accent1);
						ws.Cells[9, 1].ApplyStyle(BuiltInStyle.Percent40Accent2);
						ws.Cells[9, 2].ApplyStyle(BuiltInStyle.Percent40Accent3);
						ws.Cells[9, 3].ApplyStyle(BuiltInStyle.Percent40Accent4);
						ws.Cells[9, 4].ApplyStyle(BuiltInStyle.Percent40Accent5);
						ws.Cells[9, 5].ApplyStyle(BuiltInStyle.Percent40Accent6);
						ws.Cells[10, 0].ApplyStyle(BuiltInStyle.Percent60Accent1);
						ws.Cells[10, 1].ApplyStyle(BuiltInStyle.Percent60Accent2);
						ws.Cells[10, 2].ApplyStyle(BuiltInStyle.Percent60Accent3);
						ws.Cells[10, 3].ApplyStyle(BuiltInStyle.Percent60Accent4);
						ws.Cells[10, 4].ApplyStyle(BuiltInStyle.Percent60Accent5);
						ws.Cells[10, 5].ApplyStyle(BuiltInStyle.Percent60Accent6);
						ws.Cells[11, 0].ApplyStyle(BuiltInStyle.Accent1);
						ws.Cells[11, 1].ApplyStyle(BuiltInStyle.Accent2);
						ws.Cells[11, 2].ApplyStyle(BuiltInStyle.Accent3);
						ws.Cells[11, 3].ApplyStyle(BuiltInStyle.Accent4);
						ws.Cells[11, 4].ApplyStyle(BuiltInStyle.Accent5);
						ws.Cells[11, 5].ApplyStyle(BuiltInStyle.Accent6);
						ws.Cells[13, 0].ApplyStyle(BuiltInStyle.Comma);
						ws.Cells[13, 1].ApplyStyle(BuiltInStyle.Comma0);
						ws.Cells[13, 2].ApplyStyle(BuiltInStyle.Currency);
						ws.Cells[13, 3].ApplyStyle(BuiltInStyle.Currency0);
						ws.Cells[13, 4].ApplyStyle(BuiltInStyle.Percent);
						fpSpread2_Sheet1.Cells[0, 0].BackColor = System.Drawing.Color.FromArgb(255, 74, 74, 74);
						fpSpread2_Sheet1.Cells[2, 0].BackColor = System.Drawing.Color.FromArgb(255, 74, 74, 74);
						fpSpread2_Sheet1.Cells[5, 0].BackColor = System.Drawing.Color.FromArgb(255, 74, 74, 74);
						fpSpread2_Sheet1.Cells[7, 0].BackColor = System.Drawing.Color.FromArgb(255, 74, 74, 74);
						fpSpread2_Sheet1.Cells[12, 0].BackColor = System.Drawing.Color.FromArgb(255, 74, 74, 74);
						fpSpread2_Sheet1.Cells[14, 0].BackColor = System.Drawing.Color.FromArgb(255, 74, 74, 74);
						fpSpread2_Sheet1.Cells[0, 0].ForeColor = System.Drawing.Color.FromArgb(255, 235, 235, 235);
						fpSpread2_Sheet1.Cells[2, 0].ForeColor = System.Drawing.Color.FromArgb(255, 235, 235, 235);
						fpSpread2_Sheet1.Cells[5, 0].ForeColor = System.Drawing.Color.FromArgb(255, 235, 235, 235);
						fpSpread2_Sheet1.Cells[7, 0].ForeColor = System.Drawing.Color.FromArgb(255, 235, 235, 235);
						fpSpread2_Sheet1.Cells[12, 0].ForeColor = System.Drawing.Color.FromArgb(255, 235, 235, 235);
						fpSpread2_Sheet1.Cells[14, 0].ForeColor = System.Drawing.Color.FromArgb(255, 235, 235, 235);
						fpSpread2_Sheet1.Cells[0, 0].CanFocus = false;
						fpSpread2_Sheet1.Cells[1, 4, 1, 5].CanFocus = false;
						fpSpread2_Sheet1.Cells[1, 4, 1, 5].BackColor = System.Drawing.Color.Black;
						fpSpread2_Sheet1.Cells[2, 0].CanFocus = false;
						fpSpread2_Sheet1.Cells[4, 2, 4, 5].CanFocus = false;
						fpSpread2_Sheet1.Cells[4, 2, 4, 5].BackColor = System.Drawing.Color.Black;
						fpSpread2_Sheet1.Cells[5, 0].CanFocus = false;
						fpSpread2_Sheet1.Cells[7, 0].CanFocus = false;
						fpSpread2_Sheet1.Cells[12, 0].CanFocus = false;
						fpSpread2_Sheet1.Cells[13, 5].CanFocus = false;
						fpSpread2_Sheet1.Cells[14, 5].CanFocus = false;
						fpSpread2_Sheet1.Cells[13, 5].BackColor = System.Drawing.Color.Black;
						fpSpread2_Sheet1.Cells[15, 0, 46, 5].BackColor = System.Drawing.Color.Black;
						Border border = new Border(new BorderLine(BorderLineStyle.Thick, GrapeCity.Spreadsheet.Color.FromKnownColor(GrapeCity.Core.KnownColor.Black)));
						ws.Cells[1, 0, 1, 3].Borders.ApplyBorder(border);
						ws.Cells[3, 0, 3, 5].Borders.ApplyBorder(border);
						ws.Cells[4, 0, 4, 1].Borders.ApplyBorder(border);
						ws.Cells[6, 0, 6, 5].Borders.ApplyBorder(border);
						ws.Cells[8, 0, 11, 5].Borders.ApplyBorder(border);
						ws.Cells[13, 0, 13, 5].Borders.ApplyBorder(border);
						ws.Cells[15, 0, 46, 5].Borders.ApplyBorder(border);
						GridLine gl = new GridLine(GridLineType.None);
						fpSpread2_Sheet1.HorizontalGridLine = gl;
						fpSpread2_Sheet1.VerticalGridLine = gl;
						fpSpread2_Sheet1.Cells[14, 0].ColumnSpan = 6;
						fpSpread2_Sheet1.Cells[14, 0].CellPadding.All = 0;
						fpSpread2_Sheet1.Cells[14, 0].Text = "Custom Styles";
						fpSpread2_Sheet1.Rows[15, 46].Height = 0;
						fpSpread2_Sheet1.Cells[48, 0].ColumnSpan = 6;
						fpSpread2_Sheet1.Cells[48, 0].CellPadding.All = 0;
						TextCellType newStyle = new TextCellType();
						newStyle.BackgroundImage = new Picture(Properties.Resources.new_style);
						newStyle.BackgroundImage.AlignHorz = FarPoint.Win.HorizontalAlignment.Left;
						newStyle.BackgroundImage.AlignVert = FarPoint.Win.VerticalAlignment.Center;
						newStyle.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.Show;
						fpSpread2_Sheet1.Cells[48, 0].BackColor = System.Drawing.Color.Black;
						fpSpread2_Sheet1.Cells[48, 0].CellType = newStyle;
						fpSpread2_Sheet1.Cells[48, 0].ForeColor = System.Drawing.Color.FromArgb(255, 240, 240, 240);
						fpSpread2_Sheet1.Cells[48, 0].HorizontalAlignment = CellHorizontalAlignment.Left;
						fpSpread2_Sheet1.Cells[48, 0].Text = "&New Cell Style...";
						fpSpread2_Sheet1.Cells[48, 0].TextIndent = 26;
						fpSpread2_Sheet1.Rows[47].Height = 2;
						fpSpread2_Sheet1.Rows[49].Height = 0;
						fpSpread2_Sheet1.Cells[47, 0, 47, 5].Border = new ComplexBorder(ComplexBorderSide.Empty, new ComplexBorderSide(ComplexBorderSideStyle.ThinLine, System.Drawing.Color.FromArgb(255, 74, 74, 74)), ComplexBorderSide.Empty, ComplexBorderSide.Empty);
						fpSpread2_Sheet1.Rows[48].Height = 26;
						fpSpread2_Sheet1.FrozenTrailingRowCount = 4;
						fpSpread2_Sheet1.GrayAreaBackColor = System.Drawing.Color.Black;
						fpSpread2.SetCursor(CursorType.Normal, Cursors.Arrow);
						fpSpread2_Sheet1.SetActiveCell(1, 0);
				}

				private void fpSpread2_CellClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e)
				{
						if (e.Row == 0 || e.Row == 2 || e.Row == 5 || e.Row == 7 || e.Row == 12)
								return;
						if (e.Row == 1 && e.Column > 3)
								return;
						if (e.Row == 5 && e.Column > 1)
								return;
						if (e.Row == 13 && e.Column > 4)
								return;
						if (e.Row == 48 && e.Column == 0)
						{
								if (customStyles.Count > 50)
								{
										MessageBox.Show("You cannot create more then 50 style here.");
										return;
								}
								newStyle = new NewStyle();
								newStyle.OpenFormatDialog += NewStyle_OpenFormatDialog;
								newStyle.OKdialog += NewStyle_OKdialog;
								newStyle.ShowDialog();
								return;
						}

						Workbook wb = (Workbook)fpSpread1.AsWorkbook();
						GrapeCity.Spreadsheet.Worksheet ws = (GrapeCity.Spreadsheet.Worksheet)wb.ActiveSheet;
						CellRange[] selections = fpSpread1.ActiveSheet.GetSelections();
						if (selections.Length == 0)
								selections = new CellRange[] { new CellRange(fpSpread1.ActiveSheet.ActiveRowIndex, fpSpread1.ActiveSheet.ActiveColumnIndex, 1, 1) };
						foreach (CellRange cr in selections)
						{
								if (cr.Row == -1)
								{
									if (cr.Column == -1)
									{
										ws.Cells.Style = fpSpread2.AsWorkbook().ActiveSheet.Cells[e.Row, e.Column].Style;
										fpSpread1.ActiveSheet.DefaultStyle.CellType = fpSpread2.ActiveSheet.Cells[e.Row, e.Column].CellType;
									}
									else
									{
										ws.Columns[cr.Column, cr.Column + cr.ColumnCount - 1].Style = fpSpread2.AsWorkbook().ActiveSheet.Cells[e.Row, e.Column].Style;
										fpSpread1.ActiveSheet.Columns[cr.Column, cr.Column + cr.ColumnCount - 1].CellType = fpSpread2.ActiveSheet.Cells[e.Row, e.Column].CellType;
									}
								}
								else if (cr.Column == -1)
								{
									ws.Rows[cr.Row, cr.Row + cr.RowCount - 1].Style = fpSpread2.AsWorkbook().ActiveSheet.Cells[e.Row, e.Column].Style;
									fpSpread1.ActiveSheet.Rows[cr.Row, cr.Row + cr.RowCount - 1].CellType = fpSpread2.ActiveSheet.Cells[e.Row, e.Column].CellType;
								}
								else
								{
									ws.Cells[cr.Row, cr.Column, cr.Row + cr.RowCount - 1, cr.Column + cr.ColumnCount - 1].Style = fpSpread2.AsWorkbook().ActiveSheet.Cells[e.Row, e.Column].Style;
									fpSpread1.ActiveSheet.Cells[cr.Row, cr.Column, cr.Row + cr.RowCount - 1, cr.Column + cr.ColumnCount - 1].CellType = fpSpread2.ActiveSheet.Cells[e.Row, e.Column].CellType;
								}
						}
						Text = "Applied style \"" + fpSpread2.AsWorkbook().ActiveSheet.Cells[e.Row, e.Column].Style.Name + "\"";
				}

				private void NewStyle_OKdialog(object s, EventArgs e)
				{
						if (string.IsNullOrEmpty(newStyle.StyleName))
						{
								MessageBox.Show("Please enter a style name first.");
								return;
						}
						var styleFormat = ((GrapeCity.Spreadsheet.Worksheet)((Workbook)fpSpread2.AsWorkbook()).ActiveSheet).GetStyleFormat(49, 0);
						var celltype = fpSpread2.ActiveSheet.Cells[49, 0].CellType;
						for (int row = 15; row < 47; row++)
						{
								for (int col = 0; col < 6; col++)
								{
										var stylePresent = fpSpread2.AsWorkbook().Styles[fpSpread2.AsWorkbook().ActiveSheet.Cells[row, col].Style.Name];
										if (stylePresent.Name == "Normal")
										{
												IStyle style = ConvertStyleFormatToIStyle(newStyle.StyleName, styleFormat, newStyle.IncludeBorder, newStyle.IncludeAlignment, newStyle.IncludeProtection, newStyle.IncludePatterns, newStyle.IncludeNumber, newStyle.IncludeFont);
												if (style == null)
												{
														return;
												}

												((GrapeCity.Spreadsheet.Worksheet)((Workbook)fpSpread2.AsWorkbook()).ActiveSheet).Cells[row, col].Style = style;
												fpSpread2.ActiveSheet.Cells[row, col].CellType = celltype;
												fpSpread2.ActiveSheet.Cells[row, col].Text = style.Name;
												customStyles.Add(style.Name);
												if (newStyle.IncludeBorder)
												{
														((GrapeCity.Spreadsheet.Worksheet)((Workbook)fpSpread2.AsWorkbook()).ActiveSheet).Cells[row, col].Borders.ApplyBorder(styleFormat.Border);
												}

												fpSpread2.ActiveSheet.Rows[row].Height = fpSpread2.ActiveSheet.Rows[row].GetPreferredHeight();
												newStyle.Dispose();
												fpSpread2.ActiveSheet.Cells[49, 0].ResetCellType();
												((GrapeCity.Spreadsheet.Worksheet)((Workbook)fpSpread2.AsWorkbook()).ActiveSheet).Cells[49, 0].ApplyStyle("Normal");
												return;
										}
								}
						}
				}

				private void NewStyle_OpenFormatDialog(object s, EventArgs e)
				{
						Workbook wb = (Workbook)fpSpread2.AsWorkbook();
						Workbook workbook = wb;
						GrapeCity.Spreadsheet.Worksheet ws = (GrapeCity.Spreadsheet.Worksheet)wb.ActiveSheet;
						CellRange[] selections = new CellRange[] { new CellRange(49, 0, 1, 1) };
						ArrayList sels = new ArrayList();
						foreach (CellRange cr in selections)
								sels.Add(ws.Cells[cr.Row, cr.Column, cr.Row + cr.RowCount - 1, cr.Column + cr.ColumnCount - 1]);
						IRange[] sels_ = new IRange[sels.Count];
						sels.CopyTo(sels_);
						FormatCells dlg = new FormatCells(sels_[0]);
						dlg.ShowDialog(this);
				}

				enum ft
				{
						theme,
						color,
						effect,
						font
				}
				private string GetThemeToApply(ft initDir, string filter)
				{
						string filename = null;
						OpenFileDialog ofd = new OpenFileDialog();
						ofd.Filter = filter;
						ofd.FilterIndex = 0;
						switch (initDir)
						{
								case ft.theme:
										if (System.IO.Directory.Exists(@"C:\Program Files (x86)\Microsoft Office\root\Document Themes 16"))
												ofd.InitialDirectory = @"C:\Program Files (x86)\Microsoft Office\root\Document Themes 16";
										break;
								case ft.color:
										if (System.IO.Directory.Exists(@"C:\Program Files (x86)\Microsoft Office\root\Document Themes 16\Theme Colors"))
												ofd.InitialDirectory = @"C:\Program Files (x86)\Microsoft Office\root\Document Themes 16\Theme Colors";
										break;
								case ft.effect:
										if (System.IO.Directory.Exists(@"C:\Program Files (x86)\Microsoft Office\root\Document Themes 16\Theme Effects"))
												ofd.InitialDirectory = @"C:\Program Files (x86)\Microsoft Office\root\Document Themes 16\Theme Effects";
										break;
								case ft.font:
										if (System.IO.Directory.Exists(@"C:\Program Files (x86)\Microsoft Office\root\Document Themes 16\Theme Fonts"))
												ofd.InitialDirectory = @"C:\Program Files (x86)\Microsoft Office\root\Document Themes 16\Theme Fonts";
										break;
						}
						ofd.Title = "Apply Theme From File";
						if (ofd.ShowDialog(this) == DialogResult.OK)
						{
								filename = ofd.FileName;
						}
						return filename;
				}

				private void themeApplyThemeToolStripMenuItem_Clicked(object sender, EventArgs e)
				{
						string fileName = GetThemeToApply(ft.theme, "Excel Theme (*.THMX;*.XLSX)|*.THMX;*.XLSX|All Files (*.*)|*.*");
						if (fileName != null)
						{
								try
								{
										fpSpread1.AsWorkbook().ApplyTheme(fileName);
										fpSpread2.AsWorkbook().ApplyTheme(fpSpread1.AsWorkbook().Theme);
								}
								catch( Exception ex )
								{
										ThreadExceptionDialog dlg = new ThreadExceptionDialog(ex);
										dlg.ShowDialog(this);
								}
						}
				}

				private void themeApplyColorSchemeToolStripMenuItem_Clicked(object sender, EventArgs e)
				{
						string fileName = GetThemeToApply(ft.color, "Excel Theme Colors (*.XML)|*.XML|All Files (*.*)|*.*");
						if (fileName != null)
						{
								try
								{
										fpSpread1.AsWorkbook().Theme.ColorScheme.Load(fileName);
										fpSpread2.AsWorkbook().Theme.ColorScheme.Load(fileName);
								}
								catch (Exception ex)
								{
										ThreadExceptionDialog dlg = new ThreadExceptionDialog(ex);
										dlg.ShowDialog(this);
								}
						}
				}

				private void themeApplyEffectsSchemeToolStripMenuItem_Clicked(object sender, EventArgs e)
				{
						string fileName = GetThemeToApply(ft.effect, "Excel Theme Effects (*.EFTX)|*.EFTX|All Files (*.*)|*.*");
						if (fileName != null)
						{
								try
								{
										fpSpread1.AsWorkbook().Theme.EffectScheme.Load(fileName);
										fpSpread2.AsWorkbook().Theme.EffectScheme.Load(fileName);
								}
								catch (Exception ex)
								{
										ThreadExceptionDialog dlg = new ThreadExceptionDialog(ex);
										dlg.ShowDialog(this);
								}
						}
				}

				private void themeApplyFontSchemeToolStripMenuItem_Clicked(object sender, EventArgs e)
				{
						string fileName = GetThemeToApply(ft.font, "Excel Theme Font (*.XML)|*.XML|All Files (*.*)|*.*");
						if (fileName != null)
						{
								try
								{
										fpSpread1.AsWorkbook().Theme.FontScheme.Load(fileName);
										fpSpread2.AsWorkbook().Theme.FontScheme.Load(fileName);
								}
								catch (Exception ex)
								{
										ThreadExceptionDialog dlg = new ThreadExceptionDialog(ex);
										dlg.ShowDialog(this);
								}
						}
				}

				private void formatCellsToolStripMenuItem_Click(object sender, EventArgs e)
				{
						Workbook wb = (Workbook)fpSpread1.AsWorkbook();
						Workbook workbook = wb;
						GrapeCity.Spreadsheet.Worksheet ws = (GrapeCity.Spreadsheet.Worksheet)wb.ActiveSheet;
						CellRange[] selections = fpSpread1.ActiveSheet.GetSelections();
						if (selections.Length == 0)
								selections = new CellRange[] { new CellRange(fpSpread1.ActiveSheet.ActiveRowIndex, fpSpread1.ActiveSheet.ActiveColumnIndex, 1, 1) };
						ArrayList sels = new ArrayList();
						foreach (CellRange cr in selections)
								sels.Add(ws.Cells[cr.Row, cr.Column, cr.Row + cr.RowCount - 1, cr.Column + cr.ColumnCount - 1]);
						IRange[] sels_ = new IRange[sels.Count];
						sels.CopyTo(sels_);
						FormatCells dlg = new FormatCells(sels_[0]);
						dlg.ShowDialog(this);
				}

				void ApplyStyleAndCellTypeOnRange(IStyle style, ICellType cellType, IWorksheet worksheet, SheetView sheetView, int startRow, int startCol, int lastRow, int lastCol)
				{
						worksheet.Cells[startRow, startCol, lastRow, lastCol].Style = style;
						sheetView.Cells[startRow, startCol, lastRow, lastCol].CellType = cellType;
				}
				IStyle ConvertStyleFormatToIStyle(string stylename, StyleFormat styleFormat, bool includeBorder, bool includeAlignment, bool includeProtection, bool includePatterns, bool includeNumber, bool includeFont)
				{
						var duplicatedGoodStyle = fpSpread2.AsWorkbook().Styles[stylename];
						if (duplicatedGoodStyle == null)
						{
								duplicatedGoodStyle = fpSpread2.AsWorkbook().Styles.Add(stylename, "Good");
						}
						else
						{
								MessageBox.Show("This style name is already exist. Please enter a new name.");
								return null;
						}
						duplicatedGoodStyle.IncludeBorder = includeBorder;
						duplicatedGoodStyle.IncludeAlignment = includeAlignment;
						duplicatedGoodStyle.IncludeProtection = includeProtection;
						duplicatedGoodStyle.IncludePatterns = includePatterns;
						duplicatedGoodStyle.IncludeNumber = includeNumber;
						duplicatedGoodStyle.IncludeFont = includeFont;
						duplicatedGoodStyle.Font.ApplyFont(styleFormat.Font);
						duplicatedGoodStyle.IndentLevel = styleFormat.Alignment.Indent;
						duplicatedGoodStyle.HorizontalAlignment = styleFormat.Alignment.HAlignment;
						duplicatedGoodStyle.VerticalAlignment = styleFormat.Alignment.VAlignment;
						duplicatedGoodStyle.ShrinkToFit = styleFormat.Alignment.ShrinkToFit;
						duplicatedGoodStyle.WrapText = styleFormat.Alignment.WrapText;
						duplicatedGoodStyle.Orientation = styleFormat.Alignment.TextRotation;
						duplicatedGoodStyle.Locked = styleFormat.Protection.Locked;
						duplicatedGoodStyle.NumberFormat = styleFormat.NumberFormat.FormatCode;
						duplicatedGoodStyle.Borders.ApplyBorder(styleFormat.Border);
						duplicatedGoodStyle.Interior.ApplyInterior(styleFormat.Fill);
						return duplicatedGoodStyle;
				}


				private void fpSpread1_LeaveCell(object sender, LeaveCellEventArgs e)
				{
						Workbook wb = (Workbook)fpSpread1.AsWorkbook();
						GrapeCity.Spreadsheet.Worksheet ws = (GrapeCity.Spreadsheet.Worksheet)wb.ActiveSheet;
						SheetView sv = fpSpread1.ActiveSheet;
						IStyle s = ws.Cells[e.NewRow, e.NewColumn].Style;
						if (s.BuiltIn)
						{
								switch (s.Name)
								{
										case "Normal":
												fpSpread2_Sheet1.SetActiveCell(1, 0);
												break;
										case "Bad":
												fpSpread2_Sheet1.SetActiveCell(1, 1);
												break;
										case "Good":
												fpSpread2_Sheet1.SetActiveCell(1, 2);
												break;
										case "Neutral":
												fpSpread2_Sheet1.SetActiveCell(1, 3);
												break;
										case "Calculation":
												fpSpread2_Sheet1.SetActiveCell(3, 0);
												break;
										case "Check Cell":
												fpSpread2_Sheet1.SetActiveCell(3, 1);
												break;
										case "Explanatory Text":
												fpSpread2_Sheet1.SetActiveCell(3, 2);
												break;
										case "Input":
												fpSpread2_Sheet1.SetActiveCell(3, 3);
												break;
										case "Linked Cell":
												fpSpread2_Sheet1.SetActiveCell(3, 4);
												break;
										case "Note":
												fpSpread2_Sheet1.SetActiveCell(3, 5);
												break;
										case "Output":
												fpSpread2_Sheet1.SetActiveCell(4, 0);
												break;
										case "Warning Text":
												fpSpread2_Sheet1.SetActiveCell(4, 1);
												break;
										case "Heading1":
												fpSpread2_Sheet1.SetActiveCell(6, 0);
												break;
										case "Heading2":
												fpSpread2_Sheet1.SetActiveCell(6, 1);
												break;
										case "Heading3":
												fpSpread2_Sheet1.SetActiveCell(6, 2);
												break;
										case "Heading4":
												fpSpread2_Sheet1.SetActiveCell(6, 3);
												break;
										case "Title":
												fpSpread2_Sheet1.SetActiveCell(6, 4);
												break;
										case "Total":
												fpSpread2_Sheet1.SetActiveCell(6, 5);
												break;
										case "20% - Accent1":
												fpSpread2_Sheet1.SetActiveCell(8, 0);
												break;
										case "20% - Accent2":
												fpSpread2_Sheet1.SetActiveCell(8, 1);
												break;
										case "20% - Accent3":
												fpSpread2_Sheet1.SetActiveCell(8, 2);
												break;
										case "20% - Accent4":
												fpSpread2_Sheet1.SetActiveCell(8, 3);
												break;
										case "20% - Accent5":
												fpSpread2_Sheet1.SetActiveCell(8, 4);
												break;
										case "20% - Accent6":
												fpSpread2_Sheet1.SetActiveCell(8, 5);
												break;
										case "40% - Accent1":
												fpSpread2_Sheet1.SetActiveCell(9, 0);
												break;
										case "40% - Accent2":
												fpSpread2_Sheet1.SetActiveCell(9, 1);
												break;
										case "40% - Accent3":
												fpSpread2_Sheet1.SetActiveCell(9, 2);
												break;
										case "40% - Accent4":
												fpSpread2_Sheet1.SetActiveCell(9, 3);
												break;
										case "40% - Accent5":
												fpSpread2_Sheet1.SetActiveCell(9, 4);
												break;
										case "40% - Accent6":
												fpSpread2_Sheet1.SetActiveCell(9, 5);
												break;
										case "60% - Accent1":
												fpSpread2_Sheet1.SetActiveCell(10, 0);
												break;
										case "60% - Accent2":
												fpSpread2_Sheet1.SetActiveCell(10, 1);
												break;
										case "60% - Accent3":
												fpSpread2_Sheet1.SetActiveCell(10, 2);
												break;
										case "60% - Accent4":
												fpSpread2_Sheet1.SetActiveCell(10, 3);
												break;
										case "60% - Accent5":
												fpSpread2_Sheet1.SetActiveCell(10, 4);
												break;
										case "60% - Accent6":
												fpSpread2_Sheet1.SetActiveCell(10, 5);
												break;
										case "Accent1":
												fpSpread2_Sheet1.SetActiveCell(11, 0);
												break;
										case "Accent2":
												fpSpread2_Sheet1.SetActiveCell(11, 1);
												break;
										case "Accent3":
												fpSpread2_Sheet1.SetActiveCell(11, 2);
												break;
										case "Accent4":
												fpSpread2_Sheet1.SetActiveCell(11, 3);
												break;
										case "Accent5":
												fpSpread2_Sheet1.SetActiveCell(11, 4);
												break;
										case "Accent6":
												fpSpread2_Sheet1.SetActiveCell(11, 5);
												break;
										case "Comma":
												fpSpread2_Sheet1.SetActiveCell(13, 0);
												break;
										case "Comma [0]":
												fpSpread2_Sheet1.SetActiveCell(13, 1);
												break;
										case "Currency":
												fpSpread2_Sheet1.SetActiveCell(13, 2);
												break;
										case "Currency [0]":
												fpSpread2_Sheet1.SetActiveCell(13, 3);
												break;
										case "Percent":
												fpSpread2_Sheet1.SetActiveCell(13, 4);
												break;
								}
						}
				}
		}
}


//
//CellStyles.Designer.cs
//


namespace Spread.Worksheet.Features
{
		partial class CellStyles
		{
				/// <summary> 
				/// Required designer variable.
				/// </summary>
				private System.ComponentModel.IContainer components = null;

				/// <summary> 
				/// Clean up any resources being used.
				/// </summary>
				/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
				protected override void Dispose(bool disposing)
				{
						if (disposing && (components != null))
						{
								components.Dispose();
						}
						base.Dispose(disposing);
				}

				#region Component Designer generated code

				/// <summary> 
				/// Required method for Designer support - do not modify 
				/// the contents of this method with the code editor.
				/// </summary>
				private void InitializeComponent()
				{
						System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CellStyles));
						this.splitContainer1 = new System.Windows.Forms.SplitContainer();
						this.fpSpread2 = new FarPoint.Win.Spread.FpSpread(FarPoint.Win.Spread.LegacyBehaviors.None);
			      this.fpSpread2.OpenExcel("Resources\\BuiltInStyles.xlsx", FarPoint.Excel.ExcelOpenFlags.Exchangeable);
						this.fpSpread2_Sheet1 = this.fpSpread2.Sheets[0];
						this.menuStrip1 = new System.Windows.Forms.MenuStrip();
						this.themeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
						this.themeApplyThemeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
						this.themeApplyColorSchemeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
						this.themeApplyFontSchemeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
						this.themeApplyEffectsSchemeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
						this.formatCellsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
						this.fpSpread1 = new FarPoint.Win.Spread.FpSpread(FarPoint.Win.Spread.LegacyBehaviors.None);
						this.fpSpread1_Sheet2 = new FarPoint.Win.Spread.SheetView();
						this.pnlMain.SuspendLayout();
						((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
						this.splitContainer1.Panel1.SuspendLayout();
						this.splitContainer1.Panel2.SuspendLayout();
						this.splitContainer1.SuspendLayout();
						((System.ComponentModel.ISupportInitialize)(this.fpSpread2)).BeginInit();
						this.menuStrip1.SuspendLayout();
						((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).BeginInit();
						((System.ComponentModel.ISupportInitialize)(this.fpSpread1_Sheet2)).BeginInit();
						this.SuspendLayout();
						// 
						// pnlMain
						// 
						this.pnlMain.Controls.Add(this.splitContainer1);
						// 
						// splitContainer1
						// 
						this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
						this.splitContainer1.Location = new System.Drawing.Point(0, 0);
						this.splitContainer1.Name = "splitContainer1";
						this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
						// 
						// splitContainer1.Panel1
						// 
						this.splitContainer1.Panel1.Controls.Add(this.fpSpread2);
						this.splitContainer1.Panel1.Controls.Add(this.menuStrip1);
						// 
						// splitContainer1.Panel2
						// 
						this.splitContainer1.Panel2.Controls.Add(this.fpSpread1);
						this.splitContainer1.Size = new System.Drawing.Size(477, 487);
						this.splitContainer1.SplitterDistance = 320;
						this.splitContainer1.TabIndex = 3;
						// 
						// fpSpread2
						// 
						this.fpSpread2.Dock = System.Windows.Forms.DockStyle.Fill;
						this.fpSpread2.Location = new System.Drawing.Point(0, 24);
						this.fpSpread2.Name = "fpSpread2";
						this.fpSpread2.Size = new System.Drawing.Size(477, 296);
						this.fpSpread2.TabIndex = 4;
						this.fpSpread2.CellClick += new FarPoint.Win.Spread.CellClickEventHandler(this.fpSpread2_CellClick);
						// 
						// menuStrip1
						// 
						this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
								this.themeToolStripMenuItem,
								this.formatCellsToolStripMenuItem});
						this.menuStrip1.Location = new System.Drawing.Point(0, 0);
						this.menuStrip1.Name = "menuStrip1";
						this.menuStrip1.Size = new System.Drawing.Size(477, 24);
						this.menuStrip1.TabIndex = 3;
						this.menuStrip1.Text = "menuStrip1";
						// 
						// themeToolStripMenuItem
						// 
						this.themeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
								this.themeApplyThemeToolStripMenuItem,
								this.themeApplyColorSchemeToolStripMenuItem,
								this.themeApplyFontSchemeToolStripMenuItem,
								this.themeApplyEffectsSchemeToolStripMenuItem});
						this.themeToolStripMenuItem.Name = "themeToolStripMenuItem";
						this.themeToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
						this.themeToolStripMenuItem.Text = "Theme";
						// 
						// themeApplyThemeToolStripMenuItem
						// 
						this.themeApplyThemeToolStripMenuItem.Name = "themeApplyThemeToolStripMenuItem";
						this.themeApplyThemeToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
						this.themeApplyThemeToolStripMenuItem.Text = "Apply Theme...";
						this.themeApplyThemeToolStripMenuItem.Click += new System.EventHandler(this.themeApplyThemeToolStripMenuItem_Clicked);
						// 
						// themeApplyColorSchemeToolStripMenuItem
						// 
						this.themeApplyColorSchemeToolStripMenuItem.Name = "themeApplyColorSchemeToolStripMenuItem";
						this.themeApplyColorSchemeToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
						this.themeApplyColorSchemeToolStripMenuItem.Text = "Apply Color Scheme...";
						this.themeApplyColorSchemeToolStripMenuItem.Click += new System.EventHandler(this.themeApplyColorSchemeToolStripMenuItem_Clicked);
						// 
						// themeApplyFontSchemeToolStripMenuItem
						// 
						this.themeApplyFontSchemeToolStripMenuItem.Name = "themeApplyFontSchemeToolStripMenuItem";
						this.themeApplyFontSchemeToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
						this.themeApplyFontSchemeToolStripMenuItem.Text = "Apply Font Scheme...";
						this.themeApplyFontSchemeToolStripMenuItem.Click += new System.EventHandler(this.themeApplyFontSchemeToolStripMenuItem_Clicked);
						// 
						// themeApplyEffectsSchemeToolStripMenuItem
						// 
						this.themeApplyEffectsSchemeToolStripMenuItem.Name = "themeApplyEffectsSchemeToolStripMenuItem";
						this.themeApplyEffectsSchemeToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
						this.themeApplyEffectsSchemeToolStripMenuItem.Text = "Apply Effects Scheme...";
						this.themeApplyEffectsSchemeToolStripMenuItem.Click += new System.EventHandler(this.themeApplyEffectsSchemeToolStripMenuItem_Clicked);

						// 
						// formatCellsToolStripMenuItem
						// 
						this.formatCellsToolStripMenuItem.Name = "formatCellsToolStripMenuItem";
						this.formatCellsToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
						this.formatCellsToolStripMenuItem.Text = "Format Cells...";
						this.formatCellsToolStripMenuItem.Click += new System.EventHandler(this.formatCellsToolStripMenuItem_Click);
						// 
						// fpSpread1
						// 
						this.fpSpread2.Dock = System.Windows.Forms.DockStyle.Fill;
						this.fpSpread1.Location = new System.Drawing.Point(0, 0);
						this.fpSpread1.Name = "fpSpread1";
						this.fpSpread1.Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] {
						this.fpSpread1_Sheet2});
						this.fpSpread1.Size = new System.Drawing.Size(477, 163);
						this.fpSpread1.TabIndex = 1;
						this.fpSpread1.LeaveCell += new FarPoint.Win.Spread.LeaveCellEventHandler(this.fpSpread1_LeaveCell);
						// 
						// fpSpread1_Sheet2
						// 
						this.fpSpread1_Sheet2.Reset();
						this.fpSpread1_Sheet2.SheetName = "Sheet1";
						// Formulas and custom names must be loaded with R1C1 reference style
						this.fpSpread1_Sheet2.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1;
						this.fpSpread1_Sheet2.Protect = false;
						this.fpSpread1_Sheet2.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.A1;
						// 
						// CellStyles
						// 
						this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
						this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
						this.Name = "CellStyles";
						this.pnlMain.ResumeLayout(false);
						this.splitContainer1.Panel1.ResumeLayout(false);
						this.splitContainer1.Panel1.PerformLayout();
						this.splitContainer1.Panel2.ResumeLayout(false);
						((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
						this.splitContainer1.ResumeLayout(false);
						((System.ComponentModel.ISupportInitialize)(this.fpSpread2)).EndInit();
						this.menuStrip1.ResumeLayout(false);
						this.menuStrip1.PerformLayout();
						((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).EndInit();
						((System.ComponentModel.ISupportInitialize)(this.fpSpread1_Sheet2)).EndInit();
						this.ResumeLayout(false);

				}

				#endregion

				private System.Windows.Forms.SplitContainer splitContainer1;
				private FarPoint.Win.Spread.FpSpread fpSpread2;
				private System.Windows.Forms.MenuStrip menuStrip1;
				private System.Windows.Forms.ToolStripMenuItem themeToolStripMenuItem;
				private System.Windows.Forms.ToolStripMenuItem themeApplyThemeToolStripMenuItem;
				private System.Windows.Forms.ToolStripMenuItem themeApplyColorSchemeToolStripMenuItem;
				private System.Windows.Forms.ToolStripMenuItem themeApplyFontSchemeToolStripMenuItem;
				private System.Windows.Forms.ToolStripMenuItem themeApplyEffectsSchemeToolStripMenuItem;
				private System.Windows.Forms.ToolStripMenuItem formatCellsToolStripMenuItem;
				private FarPoint.Win.Spread.FpSpread fpSpread1;
				private FarPoint.Win.Spread.SheetView fpSpread1_Sheet2;
				private FarPoint.Win.Spread.SheetView fpSpread2_Sheet1;
		}
}


//
//NewStyle.cs
//


using System;
using System.Windows.Forms;

namespace Spread.Worksheet.Features
{
		public partial class NewStyle : Form
		{
				public delegate void ClickEventHandler(object s, EventArgs e);
				public event ClickEventHandler OpenFormatDialog;
				public event ClickEventHandler OKdialog;
				public NewStyle()
				{
						InitializeComponent();
				}

				private void btnFormat_Click(object sender, EventArgs e)
				{
						if (OpenFormatDialog != null)
						{
								OpenFormatDialog(sender, e);
						}
				}

				private void btnOK_Click(object sender, EventArgs e)
				{
						if (OKdialog != null)
						{
								OKdialog(sender, e);
						}
				}
				public bool IncludeAlignment
				{
						get
						{
								return chkAlignment.Checked;
						}
				}
				public bool IncludeBorder
				{
						get
						{
								return chkBorder.Checked;
						}
				}
				public bool IncludeProtection
				{
						get
						{
								return chkProtection.Checked;
						}
				}
				public bool IncludePatterns
				{
						get
						{
								return chkFill.Checked;
						}
				}
				public bool IncludeNumber
				{
						get
						{
								return chkNumber.Checked;
						}
				}
				public bool IncludeFont
				{
						get
						{
								return chkFont.Checked;
						}
				}
				public string StyleName {
						get
						{
								return txtStyleName.Text;
						}
				}
		}
}


//
//NewStyle.Designer.cs
//


namespace Spread.Worksheet.Features
{
		partial class NewStyle
		{
				/// <summary>
				/// Required designer variable.
				/// </summary>
				private System.ComponentModel.IContainer components = null;

				/// <summary>
				/// Clean up any resources being used.
				/// </summary>
				/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
				protected override void Dispose(bool disposing)
				{
						if (disposing && (components != null))
						{
								components.Dispose();
						}
						base.Dispose(disposing);
				}

				#region Windows Form Designer generated code

				/// <summary>
				/// Required method for Designer support - do not modify
				/// the contents of this method with the code editor.
				/// </summary>
				private void InitializeComponent()
				{
						this.lblStyle = new System.Windows.Forms.Label();
						this.txtStyleName = new System.Windows.Forms.TextBox();
						this.chkNumber = new System.Windows.Forms.CheckBox();
						this.chkFill = new System.Windows.Forms.CheckBox();
						this.chkBorder = new System.Windows.Forms.CheckBox();
						this.chkFont = new System.Windows.Forms.CheckBox();
						this.chkAlignment = new System.Windows.Forms.CheckBox();
						this.chkProtection = new System.Windows.Forms.CheckBox();
						this.btnOK = new System.Windows.Forms.Button();
						this.btnCancel = new System.Windows.Forms.Button();
						this.btnFormat = new System.Windows.Forms.Button();
						this.SuspendLayout();
						// 
						// lblStyle
						// 
						this.lblStyle.AutoSize = true;
						this.lblStyle.Location = new System.Drawing.Point(2, 13);
						this.lblStyle.Name = "lblStyle";
						this.lblStyle.Size = new System.Drawing.Size(61, 13);
						this.lblStyle.TabIndex = 0;
						this.lblStyle.Text = "Style Name";
						// 
						// txtStyleName
						// 
						this.txtStyleName.Location = new System.Drawing.Point(70, 13);
						this.txtStyleName.Name = "txtStyleName";
						this.txtStyleName.Size = new System.Drawing.Size(394, 20);
						this.txtStyleName.TabIndex = 1;
						this.txtStyleName.Text = "new_style";
						// 
						// chkNumber
						// 
						this.chkNumber.AutoSize = true;
						this.chkNumber.Checked = true;
						this.chkNumber.CheckState = System.Windows.Forms.CheckState.Checked;
						this.chkNumber.Location = new System.Drawing.Point(5, 77);
						this.chkNumber.Name = "chkNumber";
						this.chkNumber.Size = new System.Drawing.Size(63, 17);
						this.chkNumber.TabIndex = 2;
						this.chkNumber.Text = "Number";
						this.chkNumber.UseVisualStyleBackColor = true;
						// 
						// chkFill
						// 
						this.chkFill.AutoSize = true;
						this.chkFill.Checked = true;
						this.chkFill.CheckState = System.Windows.Forms.CheckState.Checked;
						this.chkFill.Location = new System.Drawing.Point(5, 203);
						this.chkFill.Name = "chkFill";
						this.chkFill.Size = new System.Drawing.Size(38, 17);
						this.chkFill.TabIndex = 3;
						this.chkFill.Text = "Fill";
						this.chkFill.UseVisualStyleBackColor = true;
						// 
						// chkBorder
						// 
						this.chkBorder.AutoSize = true;
						this.chkBorder.Checked = true;
						this.chkBorder.CheckState = System.Windows.Forms.CheckState.Checked;
						this.chkBorder.Location = new System.Drawing.Point(5, 168);
						this.chkBorder.Name = "chkBorder";
						this.chkBorder.Size = new System.Drawing.Size(57, 17);
						this.chkBorder.TabIndex = 4;
						this.chkBorder.Text = "Border";
						this.chkBorder.UseVisualStyleBackColor = true;
						// 
						// chkFont
						// 
						this.chkFont.AutoSize = true;
						this.chkFont.Checked = true;
						this.chkFont.CheckState = System.Windows.Forms.CheckState.Checked;
						this.chkFont.Location = new System.Drawing.Point(5, 137);
						this.chkFont.Name = "chkFont";
						this.chkFont.Size = new System.Drawing.Size(47, 17);
						this.chkFont.TabIndex = 5;
						this.chkFont.Text = "Font";
						this.chkFont.UseVisualStyleBackColor = true;
						// 
						// chkAlignment
						// 
						this.chkAlignment.AutoSize = true;
						this.chkAlignment.Checked = true;
						this.chkAlignment.CheckState = System.Windows.Forms.CheckState.Checked;
						this.chkAlignment.Location = new System.Drawing.Point(5, 107);
						this.chkAlignment.Name = "chkAlignment";
						this.chkAlignment.Size = new System.Drawing.Size(72, 17);
						this.chkAlignment.TabIndex = 6;
						this.chkAlignment.Text = "Alignment";
						this.chkAlignment.UseVisualStyleBackColor = true;
						// 
						// chkProtection
						// 
						this.chkProtection.AutoSize = true;
						this.chkProtection.Checked = true;
						this.chkProtection.CheckState = System.Windows.Forms.CheckState.Checked;
						this.chkProtection.Location = new System.Drawing.Point(5, 234);
						this.chkProtection.Name = "chkProtection";
						this.chkProtection.Size = new System.Drawing.Size(74, 17);
						this.chkProtection.TabIndex = 7;
						this.chkProtection.Text = "Protection";
						this.chkProtection.UseVisualStyleBackColor = true;
						// 
						// btnOK
						// 
						this.btnOK.Location = new System.Drawing.Point(298, 281);
						this.btnOK.Name = "btnOK";
						this.btnOK.Size = new System.Drawing.Size(75, 23);
						this.btnOK.TabIndex = 8;
						this.btnOK.Text = "OK";
						this.btnOK.UseVisualStyleBackColor = true;
						this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
						// 
						// btnCancel
						// 
						this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
						this.btnCancel.Location = new System.Drawing.Point(389, 281);
						this.btnCancel.Name = "btnCancel";
						this.btnCancel.Size = new System.Drawing.Size(75, 23);
						this.btnCancel.TabIndex = 9;
						this.btnCancel.Text = "Cancel";
						this.btnCancel.UseVisualStyleBackColor = true;
						// 
						// btnFormat
						// 
						this.btnFormat.Location = new System.Drawing.Point(389, 39);
						this.btnFormat.Name = "btnFormat";
						this.btnFormat.Size = new System.Drawing.Size(75, 23);
						this.btnFormat.TabIndex = 10;
						this.btnFormat.Text = "Format";
						this.btnFormat.UseVisualStyleBackColor = true;
						this.btnFormat.Click += new System.EventHandler(this.btnFormat_Click);
						// 
						// NewStyle
						// 
						this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
						this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
						this.ClientSize = new System.Drawing.Size(476, 308);
						this.Controls.Add(this.btnFormat);
						this.Controls.Add(this.btnCancel);
						this.Controls.Add(this.btnOK);
						this.Controls.Add(this.chkProtection);
						this.Controls.Add(this.chkAlignment);
						this.Controls.Add(this.chkFont);
						this.Controls.Add(this.chkBorder);
						this.Controls.Add(this.chkFill);
						this.Controls.Add(this.chkNumber);
						this.Controls.Add(this.txtStyleName);
						this.Controls.Add(this.lblStyle);
						this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
						this.MaximizeBox = false;
						this.MinimizeBox = false;
						this.Name = "NewStyle";
						this.Text = "NewStyle";
						this.ResumeLayout(false);
						this.PerformLayout();

				}

				#endregion

				private System.Windows.Forms.Label lblStyle;
				private System.Windows.Forms.TextBox txtStyleName;
				private System.Windows.Forms.CheckBox chkNumber;
				private System.Windows.Forms.CheckBox chkFill;
				private System.Windows.Forms.CheckBox chkBorder;
				private System.Windows.Forms.CheckBox chkFont;
				private System.Windows.Forms.CheckBox chkAlignment;
				private System.Windows.Forms.CheckBox chkProtection;
				private System.Windows.Forms.Button btnOK;
				private System.Windows.Forms.Button btnCancel;
				private System.Windows.Forms.Button btnFormat;
		}
}